package com.ljf.authority.infra.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljf.authority.domain.repository.AuthorityRelPermissionGroupUserRepository;
import com.ljf.authority.dto.query.AuthorityRelPermissionGroupUserQuery;
import com.ljf.authority.infra.mapper.AuthorityRelPermissionGroupUserMapper;
import com.ljf.authority.model.AuthorityRelPermissionGroupUser;
import com.ljf.authority.vo.AuthorityRelPermissionGroupUserVO;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.infra.repository.impl.BasisRepositoryImpl;
import com.ljf.common.utils.CollectionUtil;
import org.springframework.stereotype.Component;

/**
 * 权限组用户授权  数据访问接口实现
 *
 * @author LJF
 * @since 2024-11-19
 */
@Component
public class AuthorityRelPermissionGroupUserRepositoryImpl extends BasisRepositoryImpl<AuthorityRelPermissionGroupUserMapper, AuthorityRelPermissionGroupUser, AuthorityRelPermissionGroupUserQuery, AuthorityRelPermissionGroupUserVO> implements AuthorityRelPermissionGroupUserRepository {

    @Override
    protected QueryWrapper<AuthorityRelPermissionGroupUser> fillWrapper(AuthorityRelPermissionGroupUserQuery query, boolean sort) throws ServiceException {
        QueryWrapper<AuthorityRelPermissionGroupUser> wrapper = super.fillWrapper(query, sort);
        if (CollectionUtil.isNotEmpty(query.getGroupCodeList())) {
            wrapper.in(AuthorityRelPermissionGroupUser.COL_GROUP_CODE, query.getGroupCodeList());
        }
        return wrapper;
    }
}
